package pl.koziolekweb.translator.engine;

import com.google.api.translate.Language;
import com.google.api.translate.Translate;

/**
 * @author bartlomiejk
 * 
 *         $Id: TranslatorImpl.java 159 2009-03-12 19:56:51Z bjkuczynski $
 */
public class TranslatorImpl implements Translator {

	
	/**
	 * 
	 */
	private Language defaultLanguage;

	/**
	 * @param defaultLanguage
	 */
	public TranslatorImpl(Language defaultLanguage) {
		this.defaultLanguage = defaultLanguage;
	}

	public String translate(String text) throws Exception {
		return translate(text, Language.AUTO_DETECT, defaultLanguage);
	}

	public String translate(String text, Language from) throws Exception {
		return translate(text, from, defaultLanguage);
	}

	public String translate(String text, Language from, Language to) throws Exception {

		return Translate.translate(text, from, to);
	}

}
